Skip to content

Stable Config improvements #9259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Aug 15, 2025
Merged

Stable Config improvements #9259

merged 31 commits into from
Aug 15, 2025

Conversation

mtoffl01
Copy link
Contributor

@mtoffl01 mtoffl01 commented Jul 28, 2025

What Does This Do

  1. Refactors matchOperator logic to use method reference comparator for efficiency
  2. Introduces a new exception type StableConfigMappingException for better exception handling and debug logging when our custom YAML parsing fails on the StableConfig class
  3. Adds a debug log message when apm_configuration_rules is set but none of the rules match the active process
  4. Modifies constructors for StableConfig's Rule and Selector classes with a static factoring function from(Map<?, ?>) to enforce type safety at the API level

Motivation

For (1): Suggestion by @PerfectSlayer in previous PR #9201
For (2) & (3): A result of design partner troubleshooting sessions

Additional Notes

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@pr-commenter
Copy link

pr-commenter bot commented Jul 28, 2025

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mtoff/scfg-improvements
git_commit_date 1755212609 1755264751
git_commit_sha 65b2349 16d5f36
release_version 1.53.0-SNAPSHOT~65b2349214 1.52.0-SNAPSHOT~16d5f36836
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1755266777 1755266777
ci_job_id 1082175723 1082175723
ci_pipeline_id 73793242 73793242
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-2-mpah81nk 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-2-mpah81nk 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
module Agent Agent
parent None None

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 46 metrics, 13 unstable metrics.

Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.52.0-SNAPSHOT~16d5f36836, baseline=1.53.0-SNAPSHOT~65b2349214

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.045 s) : 0, 1044528
Total [baseline] (8.591 s) : 0, 8591427
Agent [candidate] (1.042 s) : 0, 1041818
Total [candidate] (8.568 s) : 0, 8568090
section iast
Agent [baseline] (1.177 s) : 0, 1176743
Total [baseline] (9.318 s) : 0, 9317815
Agent [candidate] (1.175 s) : 0, 1175315
Total [candidate] (9.308 s) : 0, 9308486
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.045 s -
Agent iast 1.177 s 132.214 ms (12.7%)
Total tracing 8.591 s -
Total iast 9.318 s 726.388 ms (8.5%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.042 s -
Agent iast 1.175 s 133.497 ms (12.8%)
Total tracing 8.568 s -
Total iast 9.308 s 740.396 ms (8.6%)
gantt
    title insecure-bank - break down per module: candidate=1.52.0-SNAPSHOT~16d5f36836, baseline=1.53.0-SNAPSHOT~65b2349214

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.422 ms) : 0, 1422
crashtracking [candidate] (1.427 ms) : 0, 1427
BytebuddyAgent [baseline] (730.962 ms) : 0, 730962
BytebuddyAgent [candidate] (729.466 ms) : 0, 729466
GlobalTracer [baseline] (241.78 ms) : 0, 241780
GlobalTracer [candidate] (241.92 ms) : 0, 241920
AppSec [baseline] (30.124 ms) : 0, 30124
AppSec [candidate] (30.04 ms) : 0, 30040
Debugger [baseline] (6.011 ms) : 0, 6011
Debugger [candidate] (6.05 ms) : 0, 6050
Remote Config [baseline] (652.874 µs) : 0, 653
Remote Config [candidate] (657.711 µs) : 0, 658
Telemetry [baseline] (12.586 ms) : 0, 12586
Telemetry [candidate] (11.325 ms) : 0, 11325
section iast
crashtracking [baseline] (1.426 ms) : 0, 1426
crashtracking [candidate] (1.428 ms) : 0, 1428
BytebuddyAgent [baseline] (849.418 ms) : 0, 849418
BytebuddyAgent [candidate] (848.743 ms) : 0, 848743
GlobalTracer [baseline] (232.346 ms) : 0, 232346
GlobalTracer [candidate] (232.981 ms) : 0, 232981
AppSec [baseline] (25.972 ms) : 0, 25972
AppSec [candidate] (27.8 ms) : 0, 27800
Debugger [baseline] (8.478 ms) : 0, 8478
Debugger [candidate] (5.784 ms) : 0, 5784
Remote Config [baseline] (581.482 µs) : 0, 581
Remote Config [candidate] (589.455 µs) : 0, 589
Telemetry [baseline] (8.272 ms) : 0, 8272
Telemetry [candidate] (8.028 ms) : 0, 8028
IAST [baseline] (29.223 ms) : 0, 29223
IAST [candidate] (29.013 ms) : 0, 29013
Loading
Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.52.0-SNAPSHOT~16d5f36836, baseline=1.53.0-SNAPSHOT~65b2349214

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.044 s) : 0, 1043627
Total [baseline] (10.637 s) : 0, 10637212
Agent [candidate] (1.051 s) : 0, 1051072
Total [candidate] (10.749 s) : 0, 10748718
section appsec
Agent [baseline] (1.222 s) : 0, 1221675
Total [baseline] (10.721 s) : 0, 10721273
Agent [candidate] (1.22 s) : 0, 1219993
Total [candidate] (10.786 s) : 0, 10785776
section iast
Agent [baseline] (1.197 s) : 0, 1196773
Total [baseline] (10.96 s) : 0, 10959574
Agent [candidate] (1.197 s) : 0, 1196723
Total [candidate] (11.061 s) : 0, 11061203
section profiling
Agent [baseline] (1.203 s) : 0, 1202842
Total [baseline] (10.968 s) : 0, 10968215
Agent [candidate] (1.194 s) : 0, 1194359
Total [candidate] (10.898 s) : 0, 10898283
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.044 s -
Agent appsec 1.222 s 178.048 ms (17.1%)
Agent iast 1.197 s 153.146 ms (14.7%)
Agent profiling 1.203 s 159.215 ms (15.3%)
Total tracing 10.637 s -
Total appsec 10.721 s 84.06 ms (0.8%)
Total iast 10.96 s 322.362 ms (3.0%)
Total profiling 10.968 s 331.003 ms (3.1%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.051 s -
Agent appsec 1.22 s 168.921 ms (16.1%)
Agent iast 1.197 s 145.651 ms (13.9%)
Agent profiling 1.194 s 143.287 ms (13.6%)
Total tracing 10.749 s -
Total appsec 10.786 s 37.058 ms (0.3%)
Total iast 11.061 s 312.485 ms (2.9%)
Total profiling 10.898 s 149.565 ms (1.4%)
gantt
    title petclinic - break down per module: candidate=1.52.0-SNAPSHOT~16d5f36836, baseline=1.53.0-SNAPSHOT~65b2349214

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.442 ms) : 0, 1442
crashtracking [candidate] (1.509 ms) : 0, 1509
BytebuddyAgent [baseline] (730.435 ms) : 0, 730435
BytebuddyAgent [candidate] (737.724 ms) : 0, 737724
GlobalTracer [baseline] (241.385 ms) : 0, 241385
GlobalTracer [candidate] (243.73 ms) : 0, 243730
AppSec [baseline] (30.013 ms) : 0, 30013
AppSec [candidate] (30.361 ms) : 0, 30361
Debugger [baseline] (6.011 ms) : 0, 6011
Debugger [candidate] (6.078 ms) : 0, 6078
Remote Config [baseline] (642.13 µs) : 0, 642
Remote Config [candidate] (660.538 µs) : 0, 661
Telemetry [baseline] (12.706 ms) : 0, 12706
Telemetry [candidate] (9.794 ms) : 0, 9794
section appsec
crashtracking [baseline] (1.44 ms) : 0, 1440
crashtracking [candidate] (1.434 ms) : 0, 1434
BytebuddyAgent [baseline] (754.182 ms) : 0, 754182
BytebuddyAgent [candidate] (753.311 ms) : 0, 753311
GlobalTracer [baseline] (235.301 ms) : 0, 235301
GlobalTracer [candidate] (234.685 ms) : 0, 234685
IAST [baseline] (23.455 ms) : 0, 23455
IAST [candidate] (23.502 ms) : 0, 23502
AppSec [baseline] (167.73 ms) : 0, 167730
AppSec [candidate] (168.436 ms) : 0, 168436
Debugger [baseline] (7.999 ms) : 0, 7999
Debugger [candidate] (8.744 ms) : 0, 8744
Remote Config [baseline] (631.882 µs) : 0, 632
Remote Config [candidate] (613.686 µs) : 0, 614
Telemetry [baseline] (9.894 ms) : 0, 9894
Telemetry [candidate] (8.226 ms) : 0, 8226
section iast
crashtracking [baseline] (1.454 ms) : 0, 1454
crashtracking [candidate] (1.45 ms) : 0, 1450
BytebuddyAgent [baseline] (865.587 ms) : 0, 865587
BytebuddyAgent [candidate] (865.122 ms) : 0, 865122
GlobalTracer [baseline] (235.486 ms) : 0, 235486
GlobalTracer [candidate] (235.086 ms) : 0, 235086
IAST [baseline] (28.635 ms) : 0, 28635
IAST [candidate] (28.003 ms) : 0, 28003
AppSec [baseline] (28.676 ms) : 0, 28676
AppSec [candidate] (29.369 ms) : 0, 29369
Debugger [baseline] (6.566 ms) : 0, 6566
Debugger [candidate] (7.479 ms) : 0, 7479
Remote Config [baseline] (592.864 µs) : 0, 593
Remote Config [candidate] (602.542 µs) : 0, 603
Telemetry [baseline] (8.5 ms) : 0, 8500
Telemetry [candidate] (8.371 ms) : 0, 8371
section profiling
crashtracking [baseline] (1.417 ms) : 0, 1417
crashtracking [candidate] (1.41 ms) : 0, 1410
BytebuddyAgent [baseline] (766.303 ms) : 0, 766303
BytebuddyAgent [candidate] (761.072 ms) : 0, 761072
GlobalTracer [baseline] (223.187 ms) : 0, 223187
GlobalTracer [candidate] (221.773 ms) : 0, 221773
AppSec [baseline] (30.273 ms) : 0, 30273
AppSec [candidate] (29.915 ms) : 0, 29915
Debugger [baseline] (6.329 ms) : 0, 6329
Debugger [candidate] (6.266 ms) : 0, 6266
Remote Config [baseline] (685.963 µs) : 0, 686
Remote Config [candidate] (671.886 µs) : 0, 672
Telemetry [baseline] (15.279 ms) : 0, 15279
Telemetry [candidate] (15.935 ms) : 0, 15935
ProfilingAgent [baseline] (109.579 ms) : 0, 109579
ProfilingAgent [candidate] (107.819 ms) : 0, 107819
Profiling [baseline] (110.223 ms) : 0, 110223
Profiling [candidate] (108.463 ms) : 0, 108463
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mtoff/scfg-improvements
git_commit_date 1755212609 1755264751
git_commit_sha 65b2349 16d5f36
release_version 1.53.0-SNAPSHOT~65b2349214 1.52.0-SNAPSHOT~16d5f36836
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1755266441 1755266441
ci_job_id 1082175724 1082175724
ci_pipeline_id 73793242 73793242
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-1-siscqlr0 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-1-siscqlr0 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Summary

Found 0 performance improvements and 1 performance regressions! Performance is the same for 11 metrics, 12 unstable metrics.

scenario Δ mean http_req_duration Δ mean throughput candidate mean http_req_duration candidate mean throughput baseline mean http_req_duration baseline mean throughput
scenario:load:insecure-bank:iast_GLOBAL:high_load worse
[+380.048µs; +759.666µs] or [+3.829%; +7.653%]
unstable
[-79.554op/s; +29.304op/s] or [-17.002%; +6.263%]
10.496ms 442.781op/s 9.926ms 467.906op/s
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.52.0-SNAPSHOT~16d5f36836, baseline=1.53.0-SNAPSHOT~65b2349214
    dateFormat X
    axisFormat %s
section baseline
no_agent (37.02 ms) : 36721, 37319
.   : milestone, 37020,
appsec (47.332 ms) : 46903, 47761
.   : milestone, 47332,
code_origins (45.358 ms) : 44957, 45760
.   : milestone, 45358,
iast (45.227 ms) : 44833, 45621
.   : milestone, 45227,
profiling (48.142 ms) : 47712, 48571
.   : milestone, 48142,
tracing (42.636 ms) : 42270, 43001
.   : milestone, 42636,
section candidate
no_agent (37.377 ms) : 37075, 37678
.   : milestone, 37377,
appsec (46.571 ms) : 46161, 46982
.   : milestone, 46571,
code_origins (45.823 ms) : 45419, 46228
.   : milestone, 45823,
iast (44.924 ms) : 44533, 45316
.   : milestone, 44924,
profiling (47.884 ms) : 47457, 48311
.   : milestone, 47884,
tracing (43.577 ms) : 43182, 43973
.   : milestone, 43577,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 37.02 ms [36.721 ms, 37.319 ms] -
appsec 47.332 ms [46.903 ms, 47.761 ms] 10.312 ms (27.9%)
code_origins 45.358 ms [44.957 ms, 45.76 ms] 8.339 ms (22.5%)
iast 45.227 ms [44.833 ms, 45.621 ms] 8.207 ms (22.2%)
profiling 48.142 ms [47.712 ms, 48.571 ms] 11.122 ms (30.0%)
tracing 42.636 ms [42.27 ms, 43.001 ms] 5.616 ms (15.2%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 37.377 ms [37.075 ms, 37.678 ms] -
appsec 46.571 ms [46.161 ms, 46.982 ms] 9.195 ms (24.6%)
code_origins 45.823 ms [45.419 ms, 46.228 ms] 8.447 ms (22.6%)
iast 44.924 ms [44.533 ms, 45.316 ms] 7.548 ms (20.2%)
profiling 47.884 ms [47.457 ms, 48.311 ms] 10.507 ms (28.1%)
tracing 43.577 ms [43.182 ms, 43.973 ms] 6.201 ms (16.6%)
Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.52.0-SNAPSHOT~16d5f36836, baseline=1.53.0-SNAPSHOT~65b2349214
    dateFormat X
    axisFormat %s
section baseline
no_agent (4.386 ms) : 4335, 4437
.   : milestone, 4386,
iast (9.168 ms) : 9020, 9316
.   : milestone, 9168,
iast_FULL (14.311 ms) : 14025, 14598
.   : milestone, 14311,
iast_GLOBAL (9.926 ms) : 9755, 10096
.   : milestone, 9926,
profiling (8.844 ms) : 8712, 8977
.   : milestone, 8844,
tracing (7.777 ms) : 7659, 7896
.   : milestone, 7777,
section candidate
no_agent (4.366 ms) : 4315, 4417
.   : milestone, 4366,
iast (9.448 ms) : 9287, 9610
.   : milestone, 9448,
iast_FULL (14.802 ms) : 14506, 15098
.   : milestone, 14802,
iast_GLOBAL (10.496 ms) : 10314, 10678
.   : milestone, 10496,
profiling (8.718 ms) : 8577, 8859
.   : milestone, 8718,
tracing (7.643 ms) : 7536, 7749
.   : milestone, 7643,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 4.386 ms [4.335 ms, 4.437 ms] -
iast 9.168 ms [9.02 ms, 9.316 ms] 4.782 ms (109.0%)
iast_FULL 14.311 ms [14.025 ms, 14.598 ms] 9.926 ms (226.3%)
iast_GLOBAL 9.926 ms [9.755 ms, 10.096 ms] 5.54 ms (126.3%)
profiling 8.844 ms [8.712 ms, 8.977 ms] 4.458 ms (101.7%)
tracing 7.777 ms [7.659 ms, 7.896 ms] 3.391 ms (77.3%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 4.366 ms [4.315 ms, 4.417 ms] -
iast 9.448 ms [9.287 ms, 9.61 ms] 5.082 ms (116.4%)
iast_FULL 14.802 ms [14.506 ms, 15.098 ms] 10.436 ms (239.0%)
iast_GLOBAL 10.496 ms [10.314 ms, 10.678 ms] 6.13 ms (140.4%)
profiling 8.718 ms [8.577 ms, 8.859 ms] 4.352 ms (99.7%)
tracing 7.643 ms [7.536 ms, 7.749 ms] 3.277 ms (75.0%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mtoff/scfg-improvements
git_commit_date 1755212609 1755264751
git_commit_sha 65b2349 16d5f36
release_version 1.53.0-SNAPSHOT~65b2349214 1.52.0-SNAPSHOT~16d5f36836
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1755266981 1755266981
ci_job_id 1082175725 1082175725
ci_pipeline_id 73793242 73793242
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-3-s5dxmlad 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-3-s5dxmlad 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 1 unstable metrics.

Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.52.0-SNAPSHOT~16d5f36836, baseline=1.53.0-SNAPSHOT~65b2349214
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.477 ms) : 1466, 1489
.   : milestone, 1477,
appsec (3.646 ms) : 3427, 3864
.   : milestone, 3646,
iast (2.213 ms) : 2151, 2276
.   : milestone, 2213,
iast_GLOBAL (2.251 ms) : 2187, 2314
.   : milestone, 2251,
profiling (2.073 ms) : 2020, 2125
.   : milestone, 2073,
tracing (2.019 ms) : 1970, 2067
.   : milestone, 2019,
section candidate
no_agent (1.474 ms) : 1463, 1486
.   : milestone, 1474,
appsec (3.59 ms) : 3378, 3803
.   : milestone, 3590,
iast (2.206 ms) : 2144, 2269
.   : milestone, 2206,
iast_GLOBAL (2.233 ms) : 2170, 2295
.   : milestone, 2233,
profiling (2.059 ms) : 2007, 2111
.   : milestone, 2059,
tracing (2.017 ms) : 1969, 2065
.   : milestone, 2017,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.477 ms [1.466 ms, 1.489 ms] -
appsec 3.646 ms [3.427 ms, 3.864 ms] 2.168 ms (146.8%)
iast 2.213 ms [2.151 ms, 2.276 ms] 736.009 µs (49.8%)
iast_GLOBAL 2.251 ms [2.187 ms, 2.314 ms] 773.429 µs (52.4%)
profiling 2.073 ms [2.02 ms, 2.125 ms] 595.244 µs (40.3%)
tracing 2.019 ms [1.97 ms, 2.067 ms] 541.376 µs (36.6%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.474 ms [1.463 ms, 1.486 ms] -
appsec 3.59 ms [3.378 ms, 3.803 ms] 2.116 ms (143.6%)
iast 2.206 ms [2.144 ms, 2.269 ms] 732.286 µs (49.7%)
iast_GLOBAL 2.233 ms [2.17 ms, 2.295 ms] 758.382 µs (51.4%)
profiling 2.059 ms [2.007 ms, 2.111 ms] 584.526 µs (39.7%)
tracing 2.017 ms [1.969 ms, 2.065 ms] 542.841 µs (36.8%)
Execution time for biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.52.0-SNAPSHOT~16d5f36836, baseline=1.53.0-SNAPSHOT~65b2349214
    dateFormat X
    axisFormat %s
section baseline
no_agent (14.834 s) : 14834000, 14834000
.   : milestone, 14834000,
appsec (14.877 s) : 14877000, 14877000
.   : milestone, 14877000,
iast (18.314 s) : 18314000, 18314000
.   : milestone, 18314000,
iast_GLOBAL (18.021 s) : 18021000, 18021000
.   : milestone, 18021000,
profiling (15.674 s) : 15674000, 15674000
.   : milestone, 15674000,
tracing (14.871 s) : 14871000, 14871000
.   : milestone, 14871000,
section candidate
no_agent (15.608 s) : 15608000, 15608000
.   : milestone, 15608000,
appsec (14.78 s) : 14780000, 14780000
.   : milestone, 14780000,
iast (18.089 s) : 18089000, 18089000
.   : milestone, 18089000,
iast_GLOBAL (17.985 s) : 17985000, 17985000
.   : milestone, 17985000,
profiling (15.345 s) : 15345000, 15345000
.   : milestone, 15345000,
tracing (14.922 s) : 14922000, 14922000
.   : milestone, 14922000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.834 s [14.834 s, 14.834 s] -
appsec 14.877 s [14.877 s, 14.877 s] 43.0 ms (0.3%)
iast 18.314 s [18.314 s, 18.314 s] 3.48 s (23.5%)
iast_GLOBAL 18.021 s [18.021 s, 18.021 s] 3.187 s (21.5%)
profiling 15.674 s [15.674 s, 15.674 s] 840.0 ms (5.7%)
tracing 14.871 s [14.871 s, 14.871 s] 37.0 ms (0.2%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.608 s [15.608 s, 15.608 s] -
appsec 14.78 s [14.78 s, 14.78 s] -828.0 ms (-5.3%)
iast 18.089 s [18.089 s, 18.089 s] 2.481 s (15.9%)
iast_GLOBAL 17.985 s [17.985 s, 17.985 s] 2.377 s (15.2%)
profiling 15.345 s [15.345 s, 15.345 s] -263.0 ms (-1.7%)
tracing 14.922 s [14.922 s, 14.922 s] -686.0 ms (-4.4%)

@@ -26,12 +26,34 @@ public Rule(List<Selector> selectors, Map<String, Object> configuration) {
}

public Rule(Object yaml) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if this constructor is too hard to read and if you recommend I move the "require fields" logic into helper functions (in a utils class to be used by both Rule and Selector?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I would rather try to bring type safety to the Java API as soon as possible even if SnakeYaml is returning loose Object.

An idiomatic Java would be to have a static builder like static Rule from(Map<?, ?> rules) and check that its parameters is the right time before calling it.
-- Note that a better type for rules would be Map<String, ?> but there is no way to enforce / test it due to type erasure in Java.

So far example, I would check the type ahead in StableConfig before trying to create rule using its fromMap:

this.apmConfigurationRules = parseRules(yaml);

// with some helper methods in StableConfig

private List<Rule> parseRules(Map<?, ?> yaml) {
    Object apmConfigurationDefaultObject = map.get("apm_configuration_default");
    if (apmConfigurationDefaultObject instanceof List) {
      return ((List<?>) apmConfigurationDefaultObject).stream()
          .filter(r -> r instanceof Map)
          .map(r -> (Map<?, ?>) r)
          .map(Rule::fromMap)
          .collect(toList());
    } else {
      return emptyList();
    }
  }

@@ -26,12 +26,34 @@ public Rule(List<Selector> selectors, Map<String, Object> configuration) {
}

public Rule(Object yaml) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I would rather try to bring type safety to the Java API as soon as possible even if SnakeYaml is returning loose Object.

An idiomatic Java would be to have a static builder like static Rule from(Map<?, ?> rules) and check that its parameters is the right time before calling it.
-- Note that a better type for rules would be Map<String, ?> but there is no way to enforce / test it due to type erasure in Java.

So far example, I would check the type ahead in StableConfig before trying to create rule using its fromMap:

this.apmConfigurationRules = parseRules(yaml);

// with some helper methods in StableConfig

private List<Rule> parseRules(Map<?, ?> yaml) {
    Object apmConfigurationDefaultObject = map.get("apm_configuration_default");
    if (apmConfigurationDefaultObject instanceof List) {
      return ((List<?>) apmConfigurationDefaultObject).stream()
          .filter(r -> r instanceof Map)
          .map(r -> (Map<?, ?>) r)
          .map(Rule::fromMap)
          .collect(toList());
    } else {
      return emptyList();
    }
  }

return value.contains(match);
default:
return false;
if (comparator.test(match)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@datadog-datadog-prod-us1
Copy link
Contributor

datadog-datadog-prod-us1 bot commented Jul 31, 2025

Code coverage: total 57.12%, base diff 0.03%, patch 88.76% (view details)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 16d5f36 | Docs | Was this helpful? Give us feedback!

@mtoffl01 mtoffl01 marked this pull request as ready for review August 4, 2025 16:37
@mtoffl01 mtoffl01 requested a review from a team as a code owner August 4, 2025 16:37
@mtoffl01 mtoffl01 requested a review from PerfectSlayer August 4, 2025 16:37
Copy link
Contributor

github-actions bot commented Aug 4, 2025

Hi! 👋 Thanks for your pull request! 🎉

To help us review it, please make sure to:

  • Add at least one type, and one component or instrumentation label to the pull request

If you need help, please check our contributing guidelines.

Copy link
Contributor

@PerfectSlayer PerfectSlayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 👍
One question about testing logging though

Copy link
Contributor

@PerfectSlayer PerfectSlayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the follow up PR and the improvements 👍

…ider/stableconfig/Rule.java

Co-authored-by: Alexey Kuznetsov <[email protected]>
@mtoffl01 mtoffl01 requested a review from a team as a code owner August 8, 2025 15:55
@mtoffl01 mtoffl01 added the type: enhancement Enhancements and improvements label Aug 12, 2025
Comment on lines 48 to 50
} else if (log.isDebugEnabled()) {
log.error("Unexpected error while reading stable configuration file {}: {}", filePath, e);
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand this if (log.isDebugEnabled())...
To me it looks like we can log that error always, because all major cases were processed in previous if block.
Also, I feel that here we have a very tricky case: you have 2 placeholders {}, but the second argument e is actually an exception and it will be treaded in a special way. So you should use only one place holder, or provide as second argument something else, for example e.getMessage().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for the log.isDebugEnabled() check: this was something @mcculls suggested; we want to print the complete exception if and only if debug is enabled, else just print the exception message. An alternative is to only print the message regardless, I suppose. WDYT?

As for the placeholder: I was not aware, thanks for sharing. 🤔 I will change this accordingly, based on what we decide on the above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it! make sense in debug to print stack trace
but code should be with one place holder:
log.error("Unexpected error while reading stable configuration file: {}", filePath, e);

@mtoffl01 mtoffl01 added comp: core Tracer core comp: logging Tracer internal logging labels Aug 12, 2025
Comment on lines 48 to 50
} else if (log.isDebugEnabled()) {
log.error("Unexpected error while reading stable configuration file {}: {}", filePath, e);
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it! make sense in debug to print stack trace
but code should be with one place holder:
log.error("Unexpected error while reading stable configuration file: {}", filePath, e);

@mtoffl01 mtoffl01 merged commit 1d77102 into master Aug 15, 2025
501 checks passed
@mtoffl01 mtoffl01 deleted the mtoff/scfg-improvements branch August 15, 2025 15:24
@github-actions github-actions bot added this to the 1.53.0 milestone Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: core Tracer core comp: logging Tracer internal logging type: enhancement Enhancements and improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants